User Defined Properties

Object GetUserProperty(userPropertyName: string);

Returns the value of a user property, this property may be predefined or only referenced within the script

Parameters

Parameter Type Description
userPropertyName String The name of the property to retrieve

Return Value Object

An object that represents the current value of the user property requested

 

Example: (Assumes a user property of 'ramp' has been created for Conveyors)

oConv1 = GetComponentByNameAndType("Conveyor1","Conveyor");
oConv1.SetUserProperty("ramp",0.3);
LogDebug("Ramp=" + oConv2.GetUserProperty("ramp"));

void SetUserProperty(userPropertyName: string, value: object);

Sets the value of a user property specified within the first parameter

Parameters

Parameter Type Description
userPropertyName String The name of the property to set
value Object The value to set the property to

Return Value - void.

 

Example: (Assumes a user property of 'ramp' has been created for Conveyors)

oConv1 = GetComponentByNameAndType("Conveyor1","Conveyor");
oConv1.SetUserProperty("ramp",0.3);
LogDebug("Ramp=" + oConv2.GetUserProperty("ramp"));

void SubscribeToUserPropertyByType (property: string, componentName: string, componentTypeName: string, callbackName: string);

or

void SubscribeToUserPropertyByType (property: string, componentName: string, componentTypeName: string, callbackName: object);

Subscribes to event callback for changes of a component user defined property

Parameters

Parameter Type Description
property String The name of the property to subscribe to
componentName String The name of the component to subscribe to
componentTypeName String The type of the component
callbackName object Can be a string (The name of the callback function) or the callback function itself

Return Value - void.

Callback definition: void xxxxxxxxxxxxx( sender, property)

Parameter Type Description
sender object The object whose property changed.
property String The name of the user property that has changed.

SubscribeToUserPropertyByType("UP1", "Conveyor1", "Conveyor", "Noop"); 
SubscribeToUserPropertyByType("UP2", "Conveyor1", "Conveyor", Noo);
function Noop (sender, property)
{
	LogDebug("Noop: " + sender.Name + ": " + sender.GetUserProperty("UP1"))
} 

function Noo (sender, property){
	LogDebug("Noo: " + sender.Name + ": " + sender.GetUserProperty("UP2"))
}
		

void SubscribeToUserProperty(property: string, componentName: string, callbackName: string);Deprecated, Use SubscribeToUserPropertyByType instead.

Subscribes to event callback for changes of a component user defined property

Parameters

Parameter Type Description
property String The name of the property to subscribe to
componentName String The name of the component to subscribe to
callbackName String The name of the callback function

Return Value - void.

void UnSubscribeToUserProperty(property: string, componentName: string, callbackName: string); Deprecated, Use UnSubscribeToUserPropertyByType instead.

Unsubscribe to an event callback for changes of a component user defined property

Parameters

Parameter Type Description
property String The name of the property to subscribe to
componentName String The name of the component to subscribe to
callbackName String The name of the callback function

Return Value - void.

void UnSubscribeToUserPropertyByType(property: string, componentName: string, componentTypeName: string, callbackName: string);

Unsubscribe to an event callback for changes of a component user defined property

Parameters

Name Type Description
property String The name of the property to subscribe to
componentName String The name of the component to subscribe to
componentTypeName String The type of the component
callbackName String The name of the callback function

Return Value - void.

void SubscribeToAllUserProperty(property: string, typeName: string, callbackName: string);

Subscribes to event callback for changes of a component user defined property

Parameters

Name Type Description
property String The name of the property to subscribe to
typeName String The name of the component type to subscribe to
callbackName String The name of the callback function

Return Value - void.

void UnSubscribeToAllUserProperty(property: string, typeName: string, callbackName: string);

Unsubscribe to an event callback for changes of a component user defined property

Parameters

Name Type Description
property String The name of the property to subscribe to
typeName String The name of the component type to subscribe to
callbackName String The name of the callback function

Return Value - void.